home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 002 / chedit.arc / EXAMP2.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1986-04-01  |  4.1 KB  |  88 lines

  1. program examp2;
  2.  
  3. {$Ipchr.i  }   { The include file that contains the definitions of the }
  4.                { character graphics routines.  THE SPACES AFTER THE .i }
  5.                { EXTENSION MUST BE INCLUDED }
  6.  
  7. var
  8.       shapes : charset;
  9.       window1,window2,window3 : charmessage;
  10.                          { Note:  if you want to save space, the definition }
  11.                          { of CHARMESSAGE can be changed to a smaller array }
  12.       i,m,n,p,errno,delay,delta : integer;
  13.                              { loop indices and such }
  14.       ch : char;             { a character for user response }
  15.  
  16. begin  { main program }
  17.    errno := readcset(shapes,'slotmchn.chr');
  18.                              { read the character set }
  19.    if errno <> -1 then       { if all is ok }
  20.       begin
  21.          graphcolormode;     { set 320 x 200 graphics }
  22.          gotoxy(1,20);
  23.          writeln('Press the Space Bar to roll again');
  24.                              { let the user know what to do }
  25.          getvect;            { save the system vector }
  26.          setvect(shapes);    { and put in our own }
  27.          for i := 0 to 4 do  { set up the bells and whistles (and cherries }
  28.             begin            { and lemons and... }
  29.                window1[i] := i;   { use these characters }
  30.                window2[i] := i+10;
  31.                window3[i] := i+20;
  32.             end;
  33.          for i := 0 to 4 do
  34.             begin
  35.                copychar(shapes,window1[i],window2[i]);
  36.                              { copy the pictures from window1 to window 2 }
  37.                copychar(shapes,window1[i],window3[i]);
  38.                              { and window 3 }
  39.             end;
  40.          repeat              { now do the display }
  41.             i := 8*(random(11)+5);
  42.                              { spin window 1 5 to 15 times (8 rows/char) }
  43.             m := i+8*(random(6)+5);
  44.                              { window 2 spins a little longer }
  45.             n := m+8*(random(6)+5);
  46.                              { and window 3 longer yet }
  47.             printcolumn(5,10,window1,1,3);
  48.                              { display the initial characters }
  49.             printcolumn(5,15,window2,1,3);
  50.             printcolumn(5,20,window3,1,3);
  51.                              { Note: for displaying 1 character, gratchar }
  52.                              { could also be used. }
  53.                              { e.g. gratchar(5,x,windowx[0],3) }
  54.             delay := 0;      { start off fast }
  55.             repeat
  56.                if i <> 0 then    { each window rolls its own number of times }
  57.                   begin
  58.                      columndown(shapes,window1,5);  { roll window }
  59.                      i := i-1;   { count it }
  60.                      if i = 0 then
  61.                         delay := delay+50;
  62.                                  { if this window is not going to roll }
  63.                                  { anymore, make up for the processing }
  64.                                  { time lost not updating it }
  65.                   end;
  66.                if m <> 0 then    { this looks just like the previous one }
  67.                   begin
  68.                      columndown(shapes,window2,5);
  69.                      m := m-1;
  70.                      if m = 0 then
  71.                         delay := delay+50;
  72.                   end;
  73.                columndown(shapes,window3,5);
  74.                n := n-1;  { the 3rd window needs no fancy processing, as we }
  75.                           { know it will be spinning to the very end }
  76.                for delta := 0 to delay do ;  { waste a little time }
  77.                delay := delay+10;    { waste a little more time next time }
  78.                printcolumn(5,10,window1,1,3);  { update the windows }
  79.                printcolumn(5,15,window2,1,3);
  80.                printcolumn(5,20,window3,1,3);
  81.             until n = 0;  { end of inner repeat loop }
  82.             read(kbd,ch); { get the users response }
  83.          until ch <> ' '; { and repeat until it is not a space }
  84.          restorevect;     { put the system vector back }
  85.          textmode;        { restore the regular screen }
  86.       end;                { of the if statement }
  87. end.                      { end of the program }
  88.